<!DOCTYPE html>
<html lang="en">
<head>
  <title>浩然金融中心管理平台</title>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"
        name="viewport">
  <#include "/common/csslib.html">
</head>
<body>
<div class="main-wrapper">
  <!-- start: MAIN CONTAINER -->
  <div class="main-container inner">
    <!-- start: PAGE -->
    <div class="main-content">
      <div class="container">
        <div class="row h-home-path">
          <div class="col-md-12">
            <ol class="breadcrumb">
              <li><i class="fa fa-home"></i>&nbsp;&nbsp;所在位置</li>
              <li>首页</li>
              <li class="active">编辑附件信息</li>
            </ol>
          </div>
        </div>
        <div class="row h-main-search">
          <form action="javascript:;" method="post">
            <div class="pull-right h-btn-group">
              <button class="btn btn-info" id="return-btn" onclick="returnIndex()"><i class="fa fa-mail-reply">&nbsp;&nbsp;</i>返回
              </button>
              <button class="btn btn-info" id="save" onclick="SystemAttachMgr.submitForm()" type="button"><i
                      class="fa fa-save">&nbsp;&nbsp;</i>保存
              </button>
            </div>
          </form>
        </div>
        <div class="form-horizontal  h-form-warp">
          <div class="h-msg-title h-table-header">
            <strong>附件信息</strong>
          </div>
          <form action="/systemAttach/saveSystemAttach" class="form-horizontal" id="systemAttachForm" method="post"
                role="form">
            <input id="id" name="id" type="hidden" value="${systemAttach.id!}"/>
            <input id="operation" name="operation" type="hidden" value="${operation!}"/>
            <div class="form-group" id="attach">
              <#list systemAttachList as attach>
              <script type="text/javascript">
                  totalFileSize = totalFileSize + parseInt("${attach.fileSize!}");
              </script>
              <img src="/resources/10.16.72.32/plugins/uploadify-v3.1/attach.gif"/>
              <a href="/systemAttach/downloadAttach?attachId=${attach.id!}" style="float: left; margin: 0 10px 0 0"
                 target="_blank">
                <span>${attach.fileName}(${attach.fileSize/1024}K)</span>
              </a>
              <span class="ui-icon ui-icon-close" lang="${attach.id!}"
                    onmouseout="$(this).removeClass('ui-icon-closethick').addClass('ui-icon-close')"
                    onmouseover="$(this).removeClass('ui-icon-close').addClass('ui-icon-closethick').css('cursor','pointer')"
                    size="${attach.fileSize!}"
                    title="删除"></span>
            </
            #list>
        </div>
        <div class="form-group">
          <input id="uploadify_attach" type="file"/>
          <a href="javascript:$('#uploadify_attach').uploadify('upload', '*')">上传文件</a> |
          <a href="javascript:$('#uploadify_attach').uploadify('cancel')">取消上传</a>
          <!-- <a href="javascript:$('#uploadify_attach').uploadify('stop')">停止上传</a> -->
          <input id="attachType_attach" name="attachType_attach" type="hidden" value="0"/>
          <input id="fileIds_attach" name="fileIds_attach" type="hidden" value=""/>
          <input id="fileNames_attach" name="fileNames_attach" type="hidden" value=""/>
          <input id="deletedIds_attach" name="deletedIds_attach" type="hidden" value=""/>
        </div>
        </form>
      </div>
    </div>
  </div>
  <!-- end: PAGE -->
</div>
<!-- end: MAIN CONTAINER -->
</div>

<#include "/common/jslib.html">
<#include "/common/uploadlib.html">
<!-- 弹窗下拉 -->
<script type="text/javascript">
    function returnIndex() {
        window.location.href = "/systemAttach/query";
    }

    $(function () {
        // 页面操作类型：add(添加)-edit(编辑)-view(查看)
        var operation = $("#operation").val();
        // 弹出窗体控制
        SystemAttachMgr = {
            // 初始化
            init: function () {
                // 查看的时候不显示保存按钮
                if (operation == "view") {
                    Jmts.setFormReadOnly();
                }
                initDict(DICTURL, FORM, operation);
                initAmtAndRate();
            },
            // init end

            // 提交数据
            submitForm: function () {
                Jmts.ajaxSubmit(document.getElementById("systemAttachForm"), function (result) {
                    if (result.success) {
                        if (operation == 'add') {
                            SystemAttachMgr.returnIndex();
                        } else {
                            Jmts.succTips(result.msg);
                            window.location.reload();
                        }
                    } else {
                        Jmts.revertAmtAndRate();
                        Jmts.warnTips(result.msg);
                    }
                });
                return false;
            },
            // submitForm end
            returnIndex: function () {
                window.location.href = "/systemAttach/query";
            }
        };
        // 执行初始化
        SystemAttachMgr.init();
        // 前台验证表单
        $("#systemAttachForm").validate();
    });
</script>
</body>
</html>
